package com.example.study_thread.a_collection;

import java.util.ArrayList;
import java.util.Collections;

public class Demo1Colections {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "12", "32", "43", "234");
        System.out.println(list);

        Collections.shuffle(list);
        System.out.println(list);
        Collections.sort(list);
        System.out.println(list);

//        按照第一个字符的ASCII码排序
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("c.举头望明月");
        list1.add("a.低头思故乡");
        list1.add("d.床前明月光");
        list1.add("b.低头思故乡");
        Collections.sort(list1);
        System.out.println(list1);
    }
}
